﻿@model KPIS.GERP.Models.ICM.InventoryStockTaking
@{
    var WarehouseService = new KPIS.GERP.WEB.GIMS.WarehouseService.WarehouseServiceClient();
    var JobSiteService = new KPIS.GERP.WEB.GIMS.JobsiteService.JobsiteServiceClient();
    
    var service = new KPIS.GERP.WEB.GIMS.DisposeService.DisposeServiceClient();
    // List ประเภทพัสดุ
    var ParcelTypeSelectList = service.SelectListResourceType();
}


<div class="widget-box">
	<div class="widget-header header-color-blue2">
        <h4 class="lighter smaller">ข้อมูลพัสดุและครุภัณฑ์</h4>
    </div>
    <div class="widget-body">
        <div class="widget-body-inner">
			<div class="widget-main">
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("วันที่รายการ :")
                    </div>
                    <div class="controls">
                        @Html.EditorFor(model => model.CreatedWhen )
                        @Html.ValidationMessageFor(model => model.CreatedWhen)
                    </div>            
                </div>
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("เรื่อง :")
                    </div>
                    <div class="controls">
                        @Html.EditorFor(model => model.StockTakingDesc)
                        @Html.ValidationMessageFor(model => model.StockTakingDesc)
                    </div>            
                </div>
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("ประเภทพัสดุ :")
                    </div>
                    <div class="controls">
                        @*@Html.DropDownListFor(model => model.ResourceTypeId, new SelectList(
                  new List<Object>{ 
                       new { value = 39 , text = "วัสดุ"  },
                       new { value = 40 , text = "ครุภัณฑ์" },
                    },
                  "value",
                  "text",
                   2))*@
                        @Html.DropDownListFor(model => model.ResourceTypeId, ParcelTypeSelectList, new { id="ddlParcelType", @class = "chzn-select input-xlarge" })
                        @Html.ValidationMessageFor(model => model.ResourceTypeId)
                    </div>            
                </div>
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("วันที่เริ่มนับ :")
                    </div>
                    <div class="controls">
                        @Html.EditorFor(model => model.StockTakingStartDate, "DateTime")
                        @Html.ValidationMessageFor(model => model.StockTakingStartDate)
                    </div>            
                </div>
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("วันที่สิ้นสุดการตรวจนับ :")
                    </div>
                    <div class="controls">
                         @Html.EditorFor(model => model.StockTakingEndDate, "DateTime")
                         @Html.ValidationMessageFor(model => model.StockTakingEndDate)
                    </div>            
                </div>
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("รายละเอียดการตรวจนับ :")
                    </div>
                    <div class="controls">
                        @Html.EditorFor(model => model.StockTakingRemark, "TextArea")
                        @Html.ValidationMessageFor(model => model.StockTakingRemark)
                    </div>
                </div>
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("คลังพัสดุ :")
                    </div>
                    <div class="controls">
                        @{if(Model == null)
                          {
                              @Html.DropDownListFor(model => model.IcmWhId , WarehouseService.LoadJobSiteSelectList(null,true)
                        , new { @class="chzn-select" })
						@Html.ValidationMessageFor(model => model.IcmWhId)
                          }
                          else
                          {
                            @Html.DropDownListFor(model => model.IcmWhId , WarehouseService.SelectListWarehouse(Model.IcmWhId)
                            , new { @class="chzn-select" })
						    @Html.ValidationMessageFor(model => model.IcmWhId)
                          }
                        }
                    </div>            
                </div>
                <div class="control-group">
                    <div class="control-label">
                        @Html.DisplayName("หน่วยงาน :")
                    </div>
                    <div class="controls">
                        @{if(Model == null)
                          {
                            @Html.DropDownListFor(model => model.JobSiteId, JobSiteService.LoadJobSiteSelectList(null,true)
                            , new { @class="chzn-select" })
						    @Html.ValidationMessageFor(model => model.JobSiteId)
                          }
                          else
                          {
                            @Html.DropDownListFor(model => model.JobSiteId, JobSiteService.JobSiteSelectList(Model.JobSiteId)
                            , new { @class="chzn-select" })
						    @Html.ValidationMessageFor(model => model.JobSiteId)
                          }
                        }
                         
                    </div>            
                </div>
            </div>
        </div>
    </div>
</div>
